package com.youlv.yl.controller;


import com.youlv.yl.dto.MoodFDto;
import com.youlv.yl.dto.UserMoodDto;
import com.youlv.yl.service.intf.UserMoodService;
import com.youlv.yl.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fenghe
 * @since 2022-01-15
 */
@RestController
@RequestMapping("/yl/mood/")
@Api(value = "实现用户动态的相关操作", tags = "实现用户动态的相关操作")
@CrossOrigin
public class UserMoodController {

    @Autowired
    private UserMoodService service;

    /** 发布动态*/
    @PostMapping("send.do")
    public R add(@RequestBody UserMoodDto dto) {
        return service.save(dto);
    }

    /** 查询我的动态*/
    @GetMapping("queryMy.do")
    public R queryMy(Long uid) {
        return service.queryMy(uid);
    }

    /** 查询动态*/
    @GetMapping("queryPage.do")
    public R queryPage(int page, int limit) {
        return service.queryPage(page, limit);
    }

    /** 查询动态详情*/
    @GetMapping("queryDetail.do")
    public R detail(Long id) {
        return service.queryDetail(id);
    }

    /** 新增转发*/
    @PostMapping("saveFor.do")
    public R saveFor(@RequestBody MoodFDto dto) {
        return service.saveForward(dto);
    }

    /** 查询转发*/
    @GetMapping("queryFors.do")
    public R fors(int id) {
        return service.queryF(id);
    }

}
